package com.mspbots.teams.sync.controller;

import com.mspbots.teams.sync.service.TeamsSyncService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

/**
 * com.mspbots.teams.sync.controller.SyncController
 *
 * @author Jason
 * @date 2020/2/12
 **/
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("teams-sync")
public class SyncController {

    private final TeamsSyncService teamsSyncService;


    @GetMapping(path = "users")
    public Mono<Object> manualSync(@RequestParam Integer tenantId) {
        Assert.notNull(tenantId, "tenant id is required ");
        return this.teamsSyncService.autoSyncUsers(tenantId);
    }

}
